import { request } from "@/utils";

//获取频道数据
export const getChannelsAPI = () => {
  return request({
    method: "GET",
    url: "/channels",
  });
};
//新增文章
export const addArticleAPI = (data) => {
  return request({
    method: "POST",
    url: "/mp/articles?draft=false",
    data,
  });
};

export const getArticleAPI = (params) => {
  return request({
    method: "GET",
    url: "/mp/articles",
    params,
  });
};

export const delArticleAPI = (id) => {
  return request({
    method: "DELETE",
    url: `/mp/articles/${id}`,
  });
};

export const getArticleByIdAPI = (id) => {
  return request({
    method: "GET",
    url: `/mp/articles/${id}`,
  });
};

export const updateArticleAPI = (id, data) => {
  return request({
    method: "PUT",
    url: `/mp/articles/${id}`,
    data,
  });
}